import React from 'react';
import { Button, Space } from 'antd';
import { ButtonProps } from 'antd/lib/button';

export interface ButtonItem extends ButtonProps {
  key: string;
  text: React.ReactNode;
}

export interface ButtonGroupProps {
  items: ButtonItem[];
  gap?: number;
  direction?: 'horizontal' | 'vertical';
}

/**
 * 按钮组组件
 * @param props 组件属性
 * @returns 按钮组组件
 */
export const ButtonGroup: React.FC<ButtonGroupProps> = ({ 
  items, 
  gap = 8, 
  direction = 'horizontal' 
}) => {
  return (
    <Space size={gap} direction={direction}>
      {items.map((item) => {
        const { key, text, ...buttonProps } = item;
        return (
          <Button key={key} {...buttonProps}>
            {text}
          </Button>
        );
      })}
    </Space>
  );
};

export default ButtonGroup; 